<template>
  <div class="container">
    <div class="shopNav-wrap">
      <div class="swipCarContainer container">
        <div class="sort">
          <div class="all-sort-list2">
            <div
              class="item bo"
              v-for="sideNav in sideNavList"
              :key="sideNav.title"
            >
              <h3>
                <a href="" class="title"
                  >{{ sideNav.title }}
                  <em class="iconfont icon-xiangyou1"></em>
                </a>
              </h3>
              <div class="item-list children  children-col-4 clearfix">
                <ul class="children-list">
                  <li v-for="(slidList, index) in sideNav.child" :key="index">
                    <a href="#" class="link clearfix">
                      <img
                        :src="slidList.img"
                        width="40"
                        height="40"
                        alt=""
                        class="thumb"
                      />
                      <span class="text">{{ slidList.title }}</span>
                    </a>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
        <!-- 引入轮播图 -->
        <Carousel></Carousel>
      </div>
    </div>
  </div>
</template>

<script>
import { reqGetIndexSideNavList } from '@/api/home'
import Carousel from '../Carousel/index.vue'
export default {
  data() {
    return {
      sideNavList: [],
    }
  },
  components: {
    Carousel,
  },
  async mounted() {
    const res = await reqGetIndexSideNavList()
    this.sideNavList = res
  },
}
</script>

<style lang="less" scoped>
@import './icon/iconfont.css';
.shopNav-wrap {
  width: 100%;
  // border-bottom: 1px solid #ccc;
}
.swipCarContainer {
  // width: 1200px;
  margin: 0 auto;
  display: flex;
  position: relative;

  .all {
    width: 210px;
    height: 45px;
    background-color: #e1251b;
    line-height: 45px;
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
  }
  .sort {
    position: absolute;
    left: 0;
    // top: 45px;
    width: 211px;
    height: 460px;
    position: absolute;
    // background: #fafafa;
    background: rgba(105, 101, 101, 0.6);
    z-index: 999;

    .all-sort-list2 {
      padding-top: 15px;
      .item {
        h3 {
          // line-height: 30px;
          // font-size: 14px;
          // font-weight: 400;
          // overflow: hidden;
          // padding: 0 20px;
          // margin: 0;

          a {
            color: #fff;
          }
          .title {
            position: relative;
            display: block;
            padding-left: 30px;
            height: 42px;
            line-height: 42px;
          }
        }

        .item-list {
          display: none;
          position: absolute;
          // width: 734px;
          min-height: 460px;
          _height: 200px;
          background: #f7f7f7;
          left: 210px;
          border: 1px solid #ddd;
          top: 0;
          z-index: 9999 !important;
        }

        &:hover {
          background-color: #ff6700;
          .item-list {
            display: block;
          }
        }
      }
    }
  }
}
.children-list {
  height: 458px;
  margin: 0;
  padding: 2px 0;
  list-style-type: none;
}

.children-list li {
  position: relative;
  float: left;
  width: 265px;
  height: 76px;
}

.children-list li.star-goods .link {
  width: 170px;
  padding-right: 0;
}
.children-list .link {
  display: block;
  padding: 18px 20px;
  line-height: 40px;
  color: #333;
  -webkit-transition: color 0.2s;
  transition: color 0.2s;
}

.children-list .link:hover {
  color: #ff6700 !important;
}

.children-list .thumb {
  float: left;
  margin-right: 12px;
  vertical-align: middle;
}

.children-list .text {
  float: left;
  width: 172px;
  line-height: 40px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.children-list .btn-buy {
  position: absolute;
  right: 10px;
  top: 26px;
  width: 58px;
  height: 22px;
  line-height: 22px;
}

.children-list-col {
  float: left;
  width: 265px;
}

.children {
  display: none;
  position: absolute;
  left: 234px;
  top: 0;
  z-index: 24;
  height: 458px;
  border: 1px solid #e0e0e0;
  border-left: 0;
  background: #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
}
// 每种类型的 大小
.children-col-1 {
  width: 265px;
}

.children-col-2 {
  width: 530px;
}

.children-col-3 {
  width: 795px;
}

.children-col-4 {
  width: 1120px;
}

.children-col-4 .children-list-col {
  width: 248px;
}

.title em[class*='iconfont'] {
  color: #fff;
  color: rgba(255, 255, 255, 0.5);
}
.title em[class*='iconfont'] {
  position: absolute;
  top: 12px;
  right: 40px;
  font-size: 16px;
  line-height: 16px;
  color: #e0e0e0;
}
</style>
